<?php 
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
include 'obj_app.php';
$connection1 = mysql_connect("1.234.53.52", "cam", "5678" ) ;
mysql_select_db("testbk130108", $connection1);
mysql_query("set names 'utf8'");
$id_employee='1323404319486';
$_SESSION['user']='dklien';
$_SESSION['bklist']=array();
$sql="SELECT a.*,e.FullName	FROM approvedoc a,employee e WHERE a.IDEmployee=e.IDEmployee  and a.IDLabel<1 AND a.IDEmployee='$id_employee' AND a.IDStatus=1 ";
$query= mysql_query($sql." ORDER BY a.Timecreate desc");
$sl=mysql_num_rows($query);
if($sl>0){
	while($row=mysql_fetch_array($query)){
		$obj= new appobj();
		$obj->newapprovedoc($row['FullName'], $row['IDApproveDoc'], $row['Tile'], $row['Content'], $row['IDEmployee'], $row['IDGroupApprove'], $row['SumMoney'], $row['Timecreate'], $row['IDStatus'], $row['IDTypeDoc'], $row['TimeApprove'], $row['comment'], $row['Description'], $row['purpose'], $row['Location'], $row['TripDate'], $row['TotalTime'], $row['EmployeePerforment'], $row['Content2'], $row['isView'], $row['IDLabel']);
		$_SESSION['bklist'][$row['IDApproveDoc']]=$obj;
	}
}

mysql_close($connection1);
$sl=count($_SESSION['bklist']);

?>
		<table border="1" style="width:100%">
    		<tr>
    			<td width="3%"><input type="checkbox" name="chonhetroi" id="chonhetroi" onclick="clickChonHetRoi(this);"/></td>
				<td width="3%">No.</td>
	            <td width="15%">Type</td>
	            <td width="30%">Title</a></td>
	            <td width="10%">Time created</a></td>
	            <td width="10%">Time approved</a></td>
    		</tr>
    	<?php 
    		if($sl>0){
    			$ob= new appobj();
    			$i=0;
    			foreach ($_SESSION['bklist'] as $k=>$gt){
    				$ob=unserialize (serialize ($gt));
    				?>
    				<tr bgcolor="#ffffff" class="highlighter"  onclick="onecheck(<?=$i?>)" style="cursor: pointer;">
						<td><input type="checkbox"  onclick="onecheck(<?=$i?>)" id="<?php echo "chon".$i; ?>" name="chon" value="<?=$ob->idapprovedoc?>" /></td>
						<td width="3%" align="center"><?=(++$i)?></td>
						<td ><div  align="left" ><?=$ob->idtypedoc?></div></td>
						<td >
							<?=$ob->title?>							
						</td>
						<td ><?=$ob->timecreat?></td>
						<td ><?=$ob->timeapprove?></td>
						
					</tr>
    				<?php 
    			}
    		}
    	?>
    	</table>